<div class="container">
  <ol class="breadcrumb">
    <li><%= link_to 'Home', root_path %></li>
    <li class="active">VMSes</li>
  </ol>
</div>

<div class="container">
  <h1>
    All registered VMSes
    <a href="<%= new_vms_path %>" class="btn btn-success"> <span class="glyphicon glyphicon-upload"></span> Register a
      new VMS</a>
  </h1>

  <br/>

  <div class="media">
    <% if @vmses.empty? %>
        <div class="alert alert-warning">
          Currently no VMSs are registered with the system.
        </div>
    <% else %>

        <table class="table table-hover">
          <thead>
          <tr>
            <th>#</th>
            <th>Name</th>
            <th>Server name</th>
            <th>Server port</th>
            <th>VMS connector</th>
            <th>Description</th>
            <th>Username</th>
            <th colspan="3"></th>
          </tr>
          </thead>

          <tbody>
          <% i = 1 %>
          <% @vmses.each do |vms| %>
              <tr>
                <td><%= i %></td>
                <td><%= vms.name %></td>
                <td><%= vms.server_ip %></td>
                <td><%= vms.server_port %></td>
                <td><%= vms.vms_connector.name %></td>
                <td><%= vms.description %></td>
                <td><%= vms.username %></td>

                <% if isOrganization? %>

                    <td><%= link_to 'Show Cameras', group_user_vms_path(vms.group_user_id, vms), :class => "btn btn-xs btn-default" %></td>
                    <td><%= link_to 'Edit', edit_group_user_vms_path(vms.group_user_id, vms), :class => "btn btn-xs btn-warning" %></td>
                    <td><%= link_to 'Delete', group_user_vms_path(vms.group_user_id, vms), method: :delete, :class => "btn btn-xs btn-danger", data: {confirm: 'Are you sure?'} %></td>

                <% else %>

                    <td><%= link_to 'Show Cameras', vms, :class => "btn btn-xs btn-default" %></td>
                    <td><%= link_to 'Edit', edit_vms_path(vms), :class => "btn btn-xs btn-warning" %></td>
                    <td><%= link_to 'Delete', vms, method: :delete, :class => "btn btn-xs btn-danger", data: {confirm: 'Are you sure?'} %></td>

                <% end %>

              </tr>
              <% i = i + 1 %>
          <% end %>
          </tbody>
        </table>
    <% end %>
  </div>
</div>
